<%@page import="java.util.Arrays"%>
<%@page import="java.util.Map.Entry"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Enumeration"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp" %>
<!DOCTYPE html>
<html lang="en">
	<head>
	<meta charset="UTF-8">
		<title>首页 - 广告营销-前台</title>
	</head>
	<body>
		<%
			String ip = request.getParameter("ip");
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getHeader("x-real-ip");
			}
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getHeader("x-forwarded-for");
			}
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getHeader("proxy-client-ip");
			}
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getHeader("wl-proxy-client-ip");
			}
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getHeader("http-client-ip");
			}
			if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
			{
				ip = request.getRemoteAddr();
			}
		%>
		<table width="80%" border="1">
			<tr>
				<td>名称</td>
				<td>链接</td>
			</tr>
			<tr>
				<td>ip</td>
				<td><%=ip %></td>
			</tr>
			<tr>
				<td>远程Ip:</td>
				<td><%=request.getRemoteAddr() %></td>
			</tr>
		</table>
		<%
				Enumeration enumer = request.getHeaderNames();
				while(enumer.hasMoreElements())
				{
					String key = (String)enumer.nextElement() ;
					String val = request.getHeader(key);
					out.println(key + "==请求头==>" + val + "<br/>");
				}
			%>
			<hr/>
			<%
				Map parameterMap = request.getParameterMap();
				for(Iterator iterator = parameterMap.entrySet().iterator();iterator.hasNext();)
				{
					Entry me = (Entry)iterator.next() ;
					String key = me.getKey() + "" ; 
					String[] vals = (String[])me.getValue() ; 
					out.println(key + "==请求体==>" + Arrays.toString(vals) + "<br/>");
				}
			%>
	</body>
</html>